package com.itheima.dao;

import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface MemberDao {
    /**
     * 根据身份证号查询会员数据
     * @param idCard
     * @return
     */
    @Select("select * from t_member where idCard = #{idCard}")
    Member getByIdCard(String idCard);

    /**
     * 注册会员
     * @param member
     */
    @Insert("insert into t_member(name,sex,idCard,phoneNumber,password,regTime) values " +
            "(#{name},#{sex},#{idCard},#{phoneNumber},#{password},#{regTime})")
    void saveMember(Member member);

    /**
     * 获取会员id
     * @param idCard
     * @return
     */
    @Select("select id from t_member where idCard = #{idCard}")
    Integer getMemberIdByIdCard(String idCard);
}
